{extend name='Common/index' /} {block name='content'}
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header clearfix">
                    <div class="box-tools pull-left form-inline">
                        <input type="text" class="form-control input-sm global_filter" placeholder="关键字">
                        <button class="btn btn-primary btn-sm serchBtn">查询</button>
                        <div class="pull-right">
                            <a href="javascript:;" onclick="syncVhost()" class="btn btn-primary btn-sm">同步</a>
                            <a href="{:url('admin/Vhosts/addvhost')}" class="btn btn-primary btn-sm">新增</a>
                        </div>
                    </div>
                </div>
                <div class="box-body">
                    <table class="table table-bordered table-hover tableData">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>产品ID</th>
                                <th>所属用户</th>
                                <th>所属服务</th>
                                <th>FTP用户名</th>
                                <th>绑定域名</th>
                                <th>主机状态</th>
                                <th>支付方式</th>
                                <th>创建时间</th>
                                <th>结束时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {if !empty($list)} {foreach name="list" item="v"}
                            <tr data-id="{$v.id}">
                                <td>{$v.id}</td>
                                <td>{$v.product_id}</td>
                                <td>{$v.user_id}</td>
                                <td>{$v.service_id}</td>
                                <td>{$v.ftp_name}</td>
                                <td>{$v.domain}</td>
                                <td>{$v.status}</td>
                                <td>{$v.paytype}</td>
                                <td>{$v.create_time}</td>
                                <td>{$v.end_time}</td>
                                <td>
                                    <a href="javascript:;">查看</a>
                                    <a href="{:url('admin/Vhosts/addvhost',['id'=>$v['id']])}">编辑</a>
                                </td>
                            </tr>
                            {/foreach} {/if}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>
{/block} {block name='js'}
<script>
    function del(t) {
        if (confirm('确认要删除这个用户组吗？')) {
            ajax("{:url('admin/Vhosts/delvhost')}", {
                id: t.parents('tr').data('id')
            }, 'delete').then((e) => {
                t.parents('tr').remove();
            })
        }
    }

    function syncVhost() {
        ajax("{:url('admin/Vhosts/syncvhost')}").then(e => {
            console.log(e);
        });
    }

    $('.tableData').DataTable({
        'paging': true,
        'fixedHeader': true,
        'lengthChange': false,
        'searching': true,
        'ordering': true,
        'info': true,
        'autoWidth': false,
        'deferRender': true,
        'processing': true,
    });
</script>
{/block}